
public class Log4j2Test {

	public static void main(String[] args) {
		//此系统属性设置,应在系统启动时执行,否则无效
		System.setProperty("java.util.logging.manager","org.apache.logging.log4j.jul.LogManager");
		java.util.logging.Logger julLogger=java.util.logging.Logger.getLogger(Log4j2Test.class.getSimpleName());
		julLogger.info("julLogger");
		
		org.apache.logging.log4j.Logger logger=org.apache.logging.log4j.LogManager.getLogger(Log4j2Test.class);
		 logger.info("logger4j2");
		 
		 org.slf4j.Logger slf4j=org.slf4j.LoggerFactory.getLogger(Log4j2Test.class);
		 slf4j.info("slf4j");
		 
		 org.apache.commons.logging.Log commonsLogging=org.apache.commons.logging.LogFactory.getLog(Log4j2Test.class);
		 commonsLogging.info("commonsLogging");
		 
		 org.apache.log4j.Logger log4j=org.apache.log4j.LogManager.getLogger(Log4j2Test.class);
		 log4j.info("log4j");
		 
	}

}
